#define _CRT_SECURE_NO_WARNINGS	

float piecewise(float x)
{
    if (x > 0)
        return x / 2 + 1;
    else if (x == 0)
        return 1;
    return (-2) * x - 1;
}